<template>
  <div id="app">
      <h3>登录界面</h3>
      <input class="form-control" type="text" v-model="username"/>
      <input class="form-control" type="password" v-model="password">
      <button name="登录" @click="login">登录</button> 
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {
      username:'',
      password:'',
      msg: 'Welcome to Your Vue.js App'
    }
  },
  methods:{
     login(){
         this.$router.push({path:'main',query: {username: this.username,password:this.password}})
     }
  },
  mounted(){
  },
  beforeDestroy(){   /*页面销毁的时候要保存一些数据，就可以监听这个销毁的生命周期函数*/
            console.log('实例销毁之前');
        },
   destroyed(){
            console.log('实例销毁完成');
        },
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
